Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

107
Vistas
Expected to find one of the known reducer keys instead: "user". Unexpected keys will be ignored

I am trying to use Redux to update a users profile. I keep getting the error

Expected to find one of the known reducer keys instead: "user". Unexpected keys will be ignored.

I have my store created with this:

import {configureStore} from '@reduxjs/toolkit';
import userProfileReducer from './slices/user';

const store = configureStore({
  reducer: {
    user: userProfileReducer,
  },
});

export default store;

The userSlice is below which is getting the error. I am passing the initial state and then using that to send to the reducer:

const initialUserState = {
  user: {
    email: '',
    name: '',
    phoneNumber: '',
    isAdmin: false,
  },
};

const UserSlice = createSlice({
  name: 'user',
  initialState: initialUserState,
  reducers: {
    user(state, action) {
      state.email = action.payload.email;
      state.name = action.payload.name;
      state.isAdmin = action.payload.isAdmin;
      state.phoneNumber = action.payload.phoneNumber;
    },
  },
});

export const userActions = UserSlice.actions;
export default UserSlice.reducer;
almost 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The first problem that I can spot is that you have one level of too deep nesting. It should be:

const initialUserState = {
  email: '',
  name: '',
  phoneNumber: '',
  isAdmin: false,
};

Does this solve the above problem?

almost 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda